//
//  UIViewController+page.h
//  zxc
//
//  Created by delicious on 2018/1/13.
//  Copyright © 2018年 李李善. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIViewController (page)
/** < 表格 > */
@property (nonatomic,strong) UITableView *tableView;
/** < 表格 > */
@property (nonatomic, strong) UICollectionView * collectionView;
/** < 默认第一页（分页） > */
@property (assign,nonatomic) NSUInteger startIndex;
/** < 当前页（分页） > */
@property (assign,nonatomic) NSUInteger currentPageIndex;
/** < model数组 > */
@property (nonatomic,strong) NSMutableArray *dataArr;
/** < 插入最后几区 > */
@property (nonatomic,assign) NSInteger insertBackSection;
/** < 插入哪几区 > */
@property (nonatomic,assign) NSInteger insertFrontSection;
/* < successBlock> */
@property (nonatomic,copy)void (^successBlock)(id data);
/* < failedBlock > */
@property (nonatomic,copy)void (^failedBlock)(NSString *error);
/** < errorBlock > */
@property (nonatomic,copy)void (^errorBlock)(id error);
/** < successListBlock > */
@property (nonatomic,copy)void (^subcessListBlock)(id data,NSInteger pageNum);
/* < failedBlock > */
@property (nonatomic,copy)void (^failedListBlock)(NSString *error);
/** < errorBlock > */
@property (nonatomic,copy)void (^errorListBlock)(id error);
/** < 是否显示无数据图片 > */
@property (nonatomic,assign) BOOL isShowDataImage;
/** < 是否显示无数据图片 > */
@property (nonatomic,assign) BOOL isFirstSection;


// 初始化celldata成功
- (void (^)())setupCellDataSuccessBlock:(UIView *)view;
// 获得celldata失败
- (void (^)())setupCellDataFailureBlock:(UIView *)view;
// 获得新增celldata 成功
- (void (^)())addNewCellDataSuccessBlock:(UIView *)view;
// 获得新增celldata失败
- (void (^)())addNewCellDataFailureBlock:(UIView *)view;

- (void)endRefreshing:(UIView *)view;


/**
 *  根据indePath从数据数组获取model
 *
 *  @param indexPath 获取model所在数据数组的位置
 */
-(id)modelForIndexPath:(NSIndexPath *_Nullable)indexPath;

/**
 *  根据的位置从数据数组删除model和单元格
 *
 *  @param index     model所在数据数组的位置
 */
-(void)removeDataArrAtIndex:(NSIndexPath *_Nullable)index;

/**
 *  cell的更新方法
 *
 *  @param cell      对于的那个cell
 *  @param model     对于model
 *  @param indexPath cell所在的indexPath
 */
- (void)onUpdateCell:(UIView *)cell model:(id)model atIndexPath:(NSIndexPath *)indexPath;
@end
